<template>
 <div class="header">
  TodoHeader:
    <h1>小黑记事本</h1>
    <input type="text" v-model="name">
    <button @click="add">添加任务</button>
    <!-- <button @click="$emit('addHandle',{
          id:Date.now(),
          name:name
        })">添加任务</button> -->
  </div>
</template>
<script>
export default{
    name:'',
    data () {
        return {
          name:''
        }
    },
    created () {
    },
    computed:{
    },
    methods:{
      add(){
        this.$emit('addHandle',{
          id:Date.now(),
          name:this.name
        })
        this.name=''
      }
    }
}
</script>
<style lang='less'  scoped>
.header{
  background-color: pink;
}
 
</style>